﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;

using System.Data.SqlClient;
using System.Data;

namespace FlotasDesktop
{
    class Utils
    {
        public string cargarProperties()
        {
            String pathProject = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            pathProject =  pathProject.Replace("\\bin\\Debug", "\\");
            pathProject = pathProject.Replace("file:\\", "");
            String pathProperties = pathProject + "Utils\\Utils.xml";
            String stringcon = "";
            try
            {
                StreamReader streamReader = new StreamReader(pathProperties);
                XmlTextReader xmlReader = new XmlTextReader(pathProperties);
                string properties = streamReader.ReadToEnd();
                streamReader.Close();
                xmlReader.ReadToFollowing("stringCon");
                xmlReader.MoveToFirstAttribute();
                stringcon = xmlReader.ReadElementContentAsString();
                Console.Write("string: " + stringcon);
            }
            catch
            {
                Console.Write("Ocurrio un error parseando el archivo de properties.");
            }
            return stringcon;
        }



        
    }
}
